#ifndef CONFIG_H
#define CONFIG_H

#pragma comment (lib, "d2d1.lib")
#pragma comment (lib, "d3d11.lib")
#pragma comment (lib, "D3DCompiler.lib")
#pragma comment (lib, "dwrite.lib")
#pragma comment (lib, "FW1FontWrapper.lib")

#include <dxgi.h>
#include <d3d11.h>
#include <d3d10.h>
#include <windowsx.h>
#include <windows.h>

#include <d2d1_1.h>
#include <d2d1.h>
#include <dwrite_1.h>

#include <DirectXMath.h>
#include <DirectXColors.h>

#include <functional>
#include <memory>
#include <wrl.h>
#include <iomanip>
#include <vector>
#include <assert.h>
#include <limits.h>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>

//#define _WIN32_WINNT = x0601

using namespace std;
using namespace DirectX;

class Config {

	public:

		Config();

		//Screen settings
		static const int SCREENRES_HOR = 800,
		                 SCREENRES_VER = 600;

        static const int MSAA_COUNT = 4;

        //Keyboard map. The virtual key codes can be found here:
		//http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
		static const int MoveCamForward           = 0x57, //W
		                 MoveCamLeft              = 0x41, //A
		                 MoveCamRight             = 0x44, //D
		                 MoveCamBack              = 0x53, //S
		                 MoveCamUp                = 0x51, //Q
		                 MoveCamDown              = 0x45; //E

		static const int btnResetCamera			  = 0x31, //1
                         btnChangeRenderMode	  = 0x32, //2
						 btnToggleFlyCamera       = 0x33, //3
						 btnToggleSprint		  = VK_SHIFT,
						 btnTargetFpsIncrease	  = VK_PRIOR, //page up
						 btnTargetFpsDecrease     = VK_NEXT,  //page down
						 btnToggleFpsCap          = VK_DELETE,
						 btnToggleDisplayStats    = VK_HOME;

		static const int USE_DEFAULT_RASTERIZER	  = 0,
			             USE_WIREFRAME_RASTERIZER = 1;

		//Textures
		string  GetTexture(int);
		int     GetTextureNumber(string);
		boolean ExistsTexture(string);
		void    AddTexture(string);
		void    RemoveTexture(string);
		void    RemoveTexture(int);
		string  GetCurrentTexture();
		boolean SetCurrentTexture(string);
		string  GetDefaultTexture();
		boolean SetDefaultTexture(string);
		int     GetNrOfTextures();

        //Materials
		string  GetMaterial(int);
		int     GetMaterial(string);
		boolean ExistsMaterial(string);
		void    AddMaterial(string);
		void    RemoveMaterial(string);
		void    RemoveMaterial(int);
		string  GetCurrentMaterial();
		boolean SetCurrentMaterial(string);
		string  GetDefaultMaterial();
		boolean SetDefaultMaterial(string);
		int     GetNrOfMaterials();

		//File paths
		string PathToAreas;
        string PathToAudio;
		string PathToTextures;

		//Identifiers
		int GetNewID();
		int CurrentID;
		int CurrentArea;

		//Camera settings
		void ToggleRenderMode(),
			 ToggleFlyCamera(),
			 ToggleDisplayStats(),
			 ToggleFrameCapped();
		boolean RenderMode,		//true = default, false = wireframe
				FlyCamera,		//true = WASD can move cam up and down, false = only Q and E can do that
				DisplayStats,	//true = display FPS, feature level support, etc.
				FrameCapped;	//true = draw at most TARGET_FPS frames
		float CameraMovementSpeed,
			  CameraMovementSpeedSprint,
			  CameraRotationSpeed;
		XMVECTOR CameraInitialPosition,
				 CameraInitialTarget,
		         CameraInitialUp;
		
		int Target_FPS;
		void IncreaseTargetFPS();
		void DecreaseTargetFPS();

		//Textures
		vector<string> Textures;
		string CurrentTexture;
		string DefaultTexture;

		//Materials
		vector<string> Materials;
		string CurrentMaterial;
		string DefaultMaterial;

};

#endif
